
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _DETALLEMATERIAL
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "DETALLEMATERIAL"
			Me.MappingName = "DETALLEMATERIAL"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_DETALLEMATERIALLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodDetalleMaterial As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_DETALLEMATERIAL.Parameters.CodDetalleMaterial, CodDetalleMaterial)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_DETALLEMATERIALLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodDetalleMaterial As SqlParameter
                Get
                    Return New SqlParameter("@CodDetalleMaterial", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodMaterial As SqlParameter
                Get
                    Return New SqlParameter("@CodMaterial", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CantUnidadMaterial As SqlParameter
                Get
                    Return New SqlParameter("@CantUnidadMaterial", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CostoUnidad As SqlParameter
                Get
                    Return New SqlParameter("@CostoUnidad", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CantExistente As SqlParameter
                Get
                    Return New SqlParameter("@CantExistente", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property LargoMaterial As SqlParameter
                Get
                    Return New SqlParameter("@LargoMaterial", SqlDbType.Decimal, 0)
                End Get
            End Property

            Public Shared ReadOnly Property AnchoMaterial As SqlParameter
                Get
                    Return New SqlParameter("@AnchoMaterial", SqlDbType.Decimal, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodDetalleMaterial As String = "codDetalleMaterial"
            Public Const CodMaterial As String = "codMaterial"
            Public Const CantUnidadMaterial As String = "cantUnidadMaterial"
            Public Const CostoUnidad As String = "costoUnidad"
            Public Const CantExistente As String = "cantExistente"
            Public Const LargoMaterial As String = "largoMaterial"
            Public Const AnchoMaterial As String = "anchoMaterial"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodDetalleMaterial) = _DETALLEMATERIAL.PropertyNames.CodDetalleMaterial
                    ht(CodMaterial) = _DETALLEMATERIAL.PropertyNames.CodMaterial
                    ht(CantUnidadMaterial) = _DETALLEMATERIAL.PropertyNames.CantUnidadMaterial
                    ht(CostoUnidad) = _DETALLEMATERIAL.PropertyNames.CostoUnidad
                    ht(CantExistente) = _DETALLEMATERIAL.PropertyNames.CantExistente
                    ht(LargoMaterial) = _DETALLEMATERIAL.PropertyNames.LargoMaterial
                    ht(AnchoMaterial) = _DETALLEMATERIAL.PropertyNames.AnchoMaterial

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodDetalleMaterial As String = "CodDetalleMaterial"
            Public Const CodMaterial As String = "CodMaterial"
            Public Const CantUnidadMaterial As String = "CantUnidadMaterial"
            Public Const CostoUnidad As String = "CostoUnidad"
            Public Const CantExistente As String = "CantExistente"
            Public Const LargoMaterial As String = "LargoMaterial"
            Public Const AnchoMaterial As String = "AnchoMaterial"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodDetalleMaterial) = _DETALLEMATERIAL.ColumnNames.CodDetalleMaterial
                    ht(CodMaterial) = _DETALLEMATERIAL.ColumnNames.CodMaterial
                    ht(CantUnidadMaterial) = _DETALLEMATERIAL.ColumnNames.CantUnidadMaterial
                    ht(CostoUnidad) = _DETALLEMATERIAL.ColumnNames.CostoUnidad
                    ht(CantExistente) = _DETALLEMATERIAL.ColumnNames.CantExistente
                    ht(LargoMaterial) = _DETALLEMATERIAL.ColumnNames.LargoMaterial
                    ht(AnchoMaterial) = _DETALLEMATERIAL.ColumnNames.AnchoMaterial

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodDetalleMaterial As String = "s_CodDetalleMaterial"
            Public Const CodMaterial As String = "s_CodMaterial"
            Public Const CantUnidadMaterial As String = "s_CantUnidadMaterial"
            Public Const CostoUnidad As String = "s_CostoUnidad"
            Public Const CantExistente As String = "s_CantExistente"
            Public Const LargoMaterial As String = "s_LargoMaterial"
            Public Const AnchoMaterial As String = "s_AnchoMaterial"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodDetalleMaterial As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodDetalleMaterial)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodDetalleMaterial, Value)
            End Set
        End Property

        Public Overridable Property CodMaterial As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodMaterial)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodMaterial, Value)
            End Set
        End Property

        Public Overridable Property CantUnidadMaterial As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.CantUnidadMaterial)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.CantUnidadMaterial, Value)
            End Set
        End Property

        Public Overridable Property CostoUnidad As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.CostoUnidad)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.CostoUnidad, Value)
            End Set
        End Property

        Public Overridable Property CantExistente As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.CantExistente)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.CantExistente, Value)
            End Set
        End Property

        Public Overridable Property LargoMaterial As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.LargoMaterial)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.LargoMaterial, Value)
            End Set
        End Property

        Public Overridable Property AnchoMaterial As Decimal
            Get
                Return MyBase.Getdecimal(ColumnNames.AnchoMaterial)
            End Get
            Set(ByVal Value As Decimal)
                MyBase.Setdecimal(ColumnNames.AnchoMaterial, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodDetalleMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.CodDetalleMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodDetalleMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodDetalleMaterial)
				Else
					Me.CodDetalleMaterial = MyBase.SetintAsString(ColumnNames.CodDetalleMaterial, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.CodMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodMaterial)
				Else
					Me.CodMaterial = MyBase.SetintAsString(ColumnNames.CodMaterial, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CantUnidadMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.CantUnidadMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.CantUnidadMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CantUnidadMaterial)
				Else
					Me.CantUnidadMaterial = MyBase.SetdecimalAsString(ColumnNames.CantUnidadMaterial, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CostoUnidad As String
			Get
				If Me.IsColumnNull(ColumnNames.CostoUnidad) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.CostoUnidad)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CostoUnidad)
				Else
					Me.CostoUnidad = MyBase.SetdecimalAsString(ColumnNames.CostoUnidad, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CantExistente As String
			Get
				If Me.IsColumnNull(ColumnNames.CantExistente) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.CantExistente)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CantExistente)
				Else
					Me.CantExistente = MyBase.SetdecimalAsString(ColumnNames.CantExistente, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_LargoMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.LargoMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.LargoMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.LargoMaterial)
				Else
					Me.LargoMaterial = MyBase.SetdecimalAsString(ColumnNames.LargoMaterial, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_AnchoMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.AnchoMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetdecimalAsString(ColumnNames.AnchoMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.AnchoMaterial)
				Else
					Me.AnchoMaterial = MyBase.SetdecimalAsString(ColumnNames.AnchoMaterial, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodDetalleMaterial() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodDetalleMaterial, Parameters.CodDetalleMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodMaterial() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodMaterial, Parameters.CodMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CantUnidadMaterial() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CantUnidadMaterial, Parameters.CantUnidadMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CostoUnidad() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CostoUnidad, Parameters.CostoUnidad)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CantExistente() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CantExistente, Parameters.CantExistente)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property LargoMaterial() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.LargoMaterial, Parameters.LargoMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property AnchoMaterial() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.AnchoMaterial, Parameters.AnchoMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodDetalleMaterial() As WhereParameter 
			Get
				If _CodDetalleMaterial_W Is Nothing Then
					_CodDetalleMaterial_W = TearOff.CodDetalleMaterial
				End If
				Return _CodDetalleMaterial_W
			End Get
		End Property

		Public ReadOnly Property CodMaterial() As WhereParameter 
			Get
				If _CodMaterial_W Is Nothing Then
					_CodMaterial_W = TearOff.CodMaterial
				End If
				Return _CodMaterial_W
			End Get
		End Property

		Public ReadOnly Property CantUnidadMaterial() As WhereParameter 
			Get
				If _CantUnidadMaterial_W Is Nothing Then
					_CantUnidadMaterial_W = TearOff.CantUnidadMaterial
				End If
				Return _CantUnidadMaterial_W
			End Get
		End Property

		Public ReadOnly Property CostoUnidad() As WhereParameter 
			Get
				If _CostoUnidad_W Is Nothing Then
					_CostoUnidad_W = TearOff.CostoUnidad
				End If
				Return _CostoUnidad_W
			End Get
		End Property

		Public ReadOnly Property CantExistente() As WhereParameter 
			Get
				If _CantExistente_W Is Nothing Then
					_CantExistente_W = TearOff.CantExistente
				End If
				Return _CantExistente_W
			End Get
		End Property

		Public ReadOnly Property LargoMaterial() As WhereParameter 
			Get
				If _LargoMaterial_W Is Nothing Then
					_LargoMaterial_W = TearOff.LargoMaterial
				End If
				Return _LargoMaterial_W
			End Get
		End Property

		Public ReadOnly Property AnchoMaterial() As WhereParameter 
			Get
				If _AnchoMaterial_W Is Nothing Then
					_AnchoMaterial_W = TearOff.AnchoMaterial
				End If
				Return _AnchoMaterial_W
			End Get
		End Property

		Private _CodDetalleMaterial_W As WhereParameter = Nothing
		Private _CodMaterial_W As WhereParameter = Nothing
		Private _CantUnidadMaterial_W As WhereParameter = Nothing
		Private _CostoUnidad_W As WhereParameter = Nothing
		Private _CantExistente_W As WhereParameter = Nothing
		Private _LargoMaterial_W As WhereParameter = Nothing
		Private _AnchoMaterial_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodDetalleMaterial_W = Nothing
			_CodMaterial_W = Nothing
			_CantUnidadMaterial_W = Nothing
			_CostoUnidad_W = Nothing
			_CantExistente_W = Nothing
			_LargoMaterial_W = Nothing
			_AnchoMaterial_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodDetalleMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodDetalleMaterial, Parameters.CodDetalleMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodMaterial, Parameters.CodMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CantUnidadMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CantUnidadMaterial, Parameters.CantUnidadMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CostoUnidad() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CostoUnidad, Parameters.CostoUnidad)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CantExistente() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CantExistente, Parameters.CantExistente)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property LargoMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.LargoMaterial, Parameters.LargoMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property AnchoMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.AnchoMaterial, Parameters.AnchoMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodDetalleMaterial() As AggregateParameter 
			Get
				If _CodDetalleMaterial_W Is Nothing Then
					_CodDetalleMaterial_W = TearOff.CodDetalleMaterial
				End If
				Return _CodDetalleMaterial_W
			End Get
		End Property

		Public ReadOnly Property CodMaterial() As AggregateParameter 
			Get
				If _CodMaterial_W Is Nothing Then
					_CodMaterial_W = TearOff.CodMaterial
				End If
				Return _CodMaterial_W
			End Get
		End Property

		Public ReadOnly Property CantUnidadMaterial() As AggregateParameter 
			Get
				If _CantUnidadMaterial_W Is Nothing Then
					_CantUnidadMaterial_W = TearOff.CantUnidadMaterial
				End If
				Return _CantUnidadMaterial_W
			End Get
		End Property

		Public ReadOnly Property CostoUnidad() As AggregateParameter 
			Get
				If _CostoUnidad_W Is Nothing Then
					_CostoUnidad_W = TearOff.CostoUnidad
				End If
				Return _CostoUnidad_W
			End Get
		End Property

		Public ReadOnly Property CantExistente() As AggregateParameter 
			Get
				If _CantExistente_W Is Nothing Then
					_CantExistente_W = TearOff.CantExistente
				End If
				Return _CantExistente_W
			End Get
		End Property

		Public ReadOnly Property LargoMaterial() As AggregateParameter 
			Get
				If _LargoMaterial_W Is Nothing Then
					_LargoMaterial_W = TearOff.LargoMaterial
				End If
				Return _LargoMaterial_W
			End Get
		End Property

		Public ReadOnly Property AnchoMaterial() As AggregateParameter 
			Get
				If _AnchoMaterial_W Is Nothing Then
					_AnchoMaterial_W = TearOff.AnchoMaterial
				End If
				Return _AnchoMaterial_W
			End Get
		End Property

		Private _CodDetalleMaterial_W As AggregateParameter = Nothing
		Private _CodMaterial_W As AggregateParameter = Nothing
		Private _CantUnidadMaterial_W As AggregateParameter = Nothing
		Private _CostoUnidad_W As AggregateParameter = Nothing
		Private _CantExistente_W As AggregateParameter = Nothing
		Private _LargoMaterial_W As AggregateParameter = Nothing
		Private _AnchoMaterial_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodDetalleMaterial_W = Nothing
		_CodMaterial_W = Nothing
		_CantUnidadMaterial_W = Nothing
		_CostoUnidad_W = Nothing
		_CantExistente_W = Nothing
		_LargoMaterial_W = Nothing
		_AnchoMaterial_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMATERIALInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodDetalleMaterial.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMATERIALUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_DETALLEMATERIALDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodDetalleMaterial)
		p.SourceColumn = ColumnNames.CodDetalleMaterial
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodDetalleMaterial)
		p.SourceColumn = ColumnNames.CodDetalleMaterial
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodMaterial)
		p.SourceColumn = ColumnNames.CodMaterial
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CantUnidadMaterial)
		p.SourceColumn = ColumnNames.CantUnidadMaterial
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CostoUnidad)
		p.SourceColumn = ColumnNames.CostoUnidad
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CantExistente)
		p.SourceColumn = ColumnNames.CantExistente
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.LargoMaterial)
		p.SourceColumn = ColumnNames.LargoMaterial
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.AnchoMaterial)
		p.SourceColumn = ColumnNames.AnchoMaterial
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

